package model;
import java.awt.*;
import java.awt.geom.Point2D;

/**
 * Player class.
 * @author Tim Cocu
 * @version 1.0
 */
public class Player 
{
	private double dXPosition, dYPosition;
	private double dWidth, dHeight;
	
	/**
	 * Constructor for instances of the player class.
	 * @param dXPosition Starting x-position for the player.
	 * @param dYPosition Starting y-position for the player.
	 */
	public Player(double dXPosition, double dYPosition, double dWidth, double dHeight)
	{
		this.dXPosition = dXPosition;
		this.dYPosition = dYPosition;
		
		this.dWidth = dWidth;
		this.dHeight = dHeight;
	}
	
	public double getWidth()
	{
		return dWidth;
	}
	
	public double getHeight()
	{
		return dHeight;
	}
	
	public Point2D.Double getPosition()
	{
		return new Point2D.Double(dXPosition, dYPosition);
	}
	
	/**
	 * Method that handles drawing the player onto the Graphics2D component.
	 * TODO Render a sprite?
	 * @param g2d The Graphics2D component the player should be drawn onto.
	 */
	public void draw(Graphics2D g2d)
	{
		if(Settings.DebugMode)
		{
			g2d.setColor(Color.WHITE);
			g2d.drawString("X: " + (int) dXPosition + " Y: " + (int) dYPosition, (int) dXPosition,(int) dYPosition);
		}
		
		g2d.setColor(Color.RED);
		g2d.fillOval((int) dXPosition,(int) dYPosition,(int) dWidth,(int) dHeight);
	}
	
	/**
	 * Method that handles player movement.
	 * TODO Very, very basic.
	 * @param iXIncrement The value the current x-position should by incremented with.
	 * @param iYIncrement The value the current y-position should be incremented with.
	 */
	public void move(double dXIncrement, double dYIncrement)
	{
		this.dXPosition += dXIncrement;
		this.dYPosition += dYIncrement;
	}

	public void setPosition(double dNewX, double dNewY) 
	{
		this.dXPosition = dNewX;
		this.dYPosition = dNewY;
	}

}
